echo '正在升级到华为云'
project_name=vue
local_project_name=vue_hello_cli
project_dir=..

echo '准备升级'
if [ ! -e "${project_dir}/${local_project_name}" ];then
        echo '升级包未找到，停止升级！'
        exit
fi

echo '进入工程目录'
cd ${project_dir}/${local_project_name}
#rm -rf ./test
echo '编译工程'
npm run build
if [ ! -e "./dist" ]; then
    echo '临时目录存在异常，停止升级！'
    exit
fi

echo '上传'${project_name}'.zip升级包到服务器'
ssh root@124.70.38.118 'rm -rf /test/'${project_name}'/*'
scp -r ./dist/* root@124.70.38.118:/test/${project_name}
ssh root@124.70.38.118 'chmod 755 -R /test/'${project_name}
echo '升级成功'
read -p '按任意键退出'